const express = require("express");
const adminHandler = require("../../router_handler/admin/admin");
//导入表单验证中间件
const expressJoi = require("@escook/express-joi");
//导入需要验证的对象
const schema = require("../../schema/admin/admin");

//创建路由对象
const router = express.Router();

// 管理员登录接口
router.post("/login",expressJoi(schema.login_schema),adminHandler.login);

// 修改管理员信息
router.post("/update_info",expressJoi(schema.update_info_schema),adminHandler.updateInfo)

// 获取管理员列表
router.get("/list",expressJoi(schema.admin_list_schema),adminHandler.adminList);

// 修改主题配置信息
router.post("/update_theme_info",expressJoi(schema.update_theme_config_schema),adminHandler.update_theme_config)

// 修改公告内容
router.post("/update_notice",expressJoi(schema.update_notice_schema),adminHandler.update_notice)

// 获取服务器信息
router.get("/server_info",adminHandler.server_info);

// 获取访问量
router.get("/request",expressJoi(schema.request_schema),adminHandler.request)

// 获取全部访问量数据
router.get("/all_request",adminHandler.all_request)

module.exports = router;